<template>
    <pageTabelLayout>
        <template #pageHeader>
            <div class="search-form divClass" v-if="headerShow" style="margin-top:20px">
                <div>
                    <a-form size="small" :model="pageData" layout="inline">
                        <a-form-item label-col-flex="80px" label="当班日期">
                            <a-date-picker  popup-container="html"  class="bacClass" v-model="pageData.beginTime" />至<a-date-picker  popup-container="html"  class="bacClass"
                                v-model="pageData.endTime" />
                        </a-form-item>
                        <a-form-item label-col-flex="80px" label="车间名称">
                            <a-input allow-clear :style="{ width: '200px' }" class="bacClass" placeholder=""
                                v-model="pageData.workshop" @press-enter="huiche" />
                        </a-form-item>
                        <a-form-item label-col-flex="80px" label="工段" field="sectionList" v-if="id == 2 || id == 4"
                            :rules="[{ required: true, message: '工段必填' }]" :validate-trigger="['change', 'blur']">
                            <a-select popup-container="html"  v-model="pageData.sectionList" :style="{ width: '360px' }" multiple allow-clear
                                class="bacClass" @focus="getAllGd">
                                <a-option v-for="item in pageData.gdList" :value="item">{{ item }}</a-option>
                            </a-select>
                        </a-form-item>
                    </a-form>
                </div>
                <div class="my-tool-bar">
                    <Toolbar style="float:right" :items="['查询', '打印']" @select="selectHandler" @dyBoufei="print">
                    </Toolbar>
                </div>
            </div>
            <div class="my-divisders">
                <a-divider orientation="center">
                    <icon-double-up v-if="headerShow" @click="headerShow = false" :strokeWidth="2" :size="18" />
                    <icon-double-down v-else @click="headerShow = true" :strokeWidth="2" :size="18" />
                </a-divider>
            </div>
        </template>
        <template #pageTabel>
            <a-tabs   :lazy-load="true" :justify="true" default-active-key="1" @change="handoff">
                <a-tab-pane title="设备产量日报" key="1">
                    <a-spin :loading="pageData.pageLoading" tip="加载中" dot style="height:100%;width: 100%;z-index:999 ;">
                        <AgGridVuesCopys :rowHeight="33" :headerHeight="33" :suppressCopyRowsToClipboard="true" rowSelection="multiple" @grid-ready="gridReady"
                            style="height:95%;" :localeText="localeText1" :defaultColDef="defaultColDef"
                            :rowClassRules="rowClassRules" class='ag-theme-alpine' :rowData="table.dataList"
                            :columnDefs="tc">
                        </AgGridVuesCopys>
                    </a-spin>
                </a-tab-pane>
                <a-tab-pane title="工艺分类" key="2">
                    <a-spin :loading="pageData.pageLoading" tip="加载中" dot style="height:100%;width: 100%;z-index:999 ;">
                        <AgGridVuesCopys :rowHeight="33" :headerHeight="33" :suppressCopyRowsToClipboard="true" rowSelection="multiple" @grid-ready="gridReady2"
                            style="height:95%;" :localeText="localeText1" :defaultColDef="defaultColDef"
                            :rowClassRules="rowClassRules2" class='ag-theme-alpine' :rowData="table.dataList"
                            :columnDefs="tc2">
                        </AgGridVuesCopys>
                    </a-spin>
                </a-tab-pane>
                <!-- <a-tab-pane title="后整部分" key="3">
                    <a-spin :loading="pageData.pageLoading" tip="加载中" dot style="height:100%;width: 100%;z-index:999 ;">
                        <AgGridVuesCopys :rowHeight="33" :headerHeight="33" :suppressCopyRowsToClipboard="true" rowSelection="multiple" @grid-ready="gridReady3"
                            style="height:95%;" :localeText="localeText1" :defaultColDef="defaultColDef"
                            class='ag-theme-alpine' :rowData="table.dataList" :columnDefs="tc3">
                        </AgGridVuesCopys>
                    </a-spin>
                </a-tab-pane> -->
                <a-tab-pane title="批色部分" key="4">
                    <a-spin :loading="pageData.pageLoading" tip="加载中" dot style="height:100%;width: 100%;z-index:999 ;">
                        <AgGridVuesCopys :rowHeight="33" :headerHeight="33" :suppressCopyRowsToClipboard="true" rowSelection="multiple" @grid-ready="gridReady4"
                            style="height:95%;" :localeText="localeText1" :defaultColDef="defaultColDef"
                            :rowClassRules="rowClassRules4" class='ag-theme-alpine' :rowData="table.dataList"
                            :columnDefs="tc4">
                        </AgGridVuesCopys>
                    </a-spin>
                </a-tab-pane>
                <a-tab-pane title="回修部分" key="5">
                    <a-spin :loading="pageData.pageLoading" tip="加载中" dot style="height:100%;width: 100%;z-index:999 ;">
                        <AgGridVuesCopys :rowHeight="33" :headerHeight="33" :suppressCopyRowsToClipboard="true" rowSelection="multiple" @grid-ready="gridReady5"
                            style="height:95%;" :localeText="localeText1" :defaultColDef="defaultColDef"
                            :rowClassRules="rowClassRules5" class='ag-theme-alpine' :rowData="table.dataList"
                            :columnDefs="tc5">
                        </AgGridVuesCopys>
                    </a-spin>
                </a-tab-pane>
                <a-tab-pane title="产量统计" key="6">
                    <a-spin :loading="pageData.pageLoading" tip="加载中" dot style="height:100%;width: 100%;z-index:999 ;">
                        <AgGridVuesCopys :rowHeight="33" :headerHeight="33" :suppressCopyRowsToClipboard="true" rowSelection="multiple" @grid-ready="gridReady6"
                            style="height:95%;" :localeText="localeText1" :defaultColDef="defaultColDef"
                            :rowClassRules="rowClassRules6" class='ag-theme-alpine' :rowData="table.dataList"
                            :columnDefs="tc6">
                        </AgGridVuesCopys>
                    </a-spin>
                </a-tab-pane>
            </a-tabs>
        </template>
        <paginationCopys :page-size-options="pagingList1" :total="total" show-total show-jumper show-page-size
            @change="PageSize" @page-size-change="change1" style="justify-content: center;" :page-size="size" v-if="id != 5"
            :current="page" />
        <a-modal draggable :visible="visible" @ok="handleOk" @cancel="handleCancel" okText="打印" cancelText="关闭"
            unmountOnClose :width=794>
            <template #title>
                打印
            </template>
            <div style="height: 600px;overflow: auto;">
                <div id="pro1">
                    <h2 style="margin: 0 auto;width: 100%;text-align: center;">后整生产报表</h2>
                    <!-- 定型部分 -->
                    <table style="border-collapse:collapse;width:100%;" class="table">
                        <tr>
                            <td colspan="7" style="font-weight:bold;">定型部分</td>
                        </tr>
                        <tr>
                            <td rowspan="2">机台</td>
                            <td>A班</td>
                            <td>B班</td>
                            <td rowspan="2">合计</td>
                        </tr>
                        <tr>
                            <td>过机量(吨)</td>
                            <td>过机量(吨)</td>
                        </tr>
                        <tr v-for="(item, index) in pageData.printList" :key="index">
                            <td>{{ item['device'] }}</td>
                            <td>{{ item['AClasses'] }}</td>
                            <td>{{ item['BClasses'] }}</td>
                            <td>{{ item['totalNum'] }}</td>
                        </tr>
                    </table>

                    <!-- 工艺分类 -->
                    <table style="border-collapse:collapse;width:100%;margin-top:15px;" class="table">
                        <tr>
                            <td colspan="7" style="font-weight:bold;">工艺分类</td>
                        </tr>
                        <tr>
                            <td rowspan="2">工艺类型</td>
                            <td>A班</td>
                            <td>B班</td>
                            <td>合计</td>
                        </tr>
                        <tr>
                            <td>吨</td>
                            <td>吨</td>
                            <td>吨</td>
                        </tr>
                        <tr>
                            <td>定型机干布</td>
                            <td>322.90</td>
                            <td>325.01</td>
                            <td>647.99</td>
                        </tr>
                        <tr v-for="(item, index) in pageData.printList2" :key="index">
                            <td>{{ item['process'] }}</td>
                            <td>{{ item['AClasses'] }}</td>
                            <td>{{ item['BClasses'] }}</td>
                            <td>{{ item['totalNum'] }}</td>
                        </tr>
                    </table>
                    <!-- 批色部分 -->
                    <table style="border-collapse:collapse;width:100%;margin-top: 15px;" class="table">
                        <tr>
                            <td colspan="7" style="font-weight:bold;">批色部分</td>
                        </tr>
                        <tr>
                            <td rowspan="2">工序</td>
                            <td colspan="2">A班</td>
                            <td colspan="2">B班</td>
                            <td colspan="2">合计</td>
                        </tr>
                        <tr>
                            <td>吨</td>
                            <td>比例</td>
                            <td>吨</td>
                            <td>比例</td>
                            <td>吨</td>
                            <td>比例</td>
                        </tr>
                        <tr v-for="(item, index) in pageData.printList4" :key="index">
                            <td>{{ item['process'] }}</td>
                            <td>{{ item['ACanUseHouseNum'] }}</td>
                            <td>{{ item['ACanUseWeight'] }}</td>
                            <td>{{ item['BCanUseHouseNum'] }}</td>
                            <td>{{ item['BCanUseWeight'] }}</td>
                            <td>{{ item['totalCanUseHouseNum'] }}</td>
                            <td>{{ item['totalCanUseWeight'] }}</td>
                        </tr>
                    </table>
                    <!-- 回修部分 -->
                    <table style="border-collapse:collapse;width:100%;margin-top: 15px;" class="table">
                        <tr>
                            <td colspan="7" style="font-weight:bold;">回修部分</td>
                        </tr>
                        <tr>
                            <td rowspan="2">责任部门</td>
                            <td colspan="2">A班</td>
                            <td colspan="2">B班</td>
                            <td colspan="2">合计</td>
                        </tr>
                        <tr>
                            <td>回修量</td>
                            <td>比例</td>
                            <td>回修量</td>
                            <td>比例</td>
                            <td>回修量</td>
                            <td>比例</td>
                        </tr>
                        <tr v-for="(item, index) in pageData.printList5" :key="index">
                            <td>{{ item['dutyDep'] }}</td>
                            <td>{{ item['ACanUseWeight'] }}</td>
                            <td>{{ item['ARatio'] }}</td>
                            <td>{{ item['BCanUseWeight'] }}</td>
                            <td>{{ item['BRatio'] }}</td>
                            <td>{{ item['totalNum'] }}</td>
                            <td>{{ item['totalRatio'] }}</td>
                        </tr>
                    </table>
                    <!-- 产量统计 -->
                    <table style="border-collapse:collapse;width:100%;margin-top: 15px;" class="table">
                        <tr>
                            <td colspan="7" style="font-weight:bold;">产量统计</td>
                        </tr>
                        <tr>
                            <td rowspan="2">工艺</td>
                            <td colspan="2">A班</td>
                            <td colspan="2">B班</td>
                            <td colspan="2">合计</td>
                        </tr>
                        <tr>
                            <td>条</td>
                            <td>吨</td>
                            <td>条</td>
                            <td>吨</td>
                            <td>条</td>
                            <td>吨</td>
                        </tr>
                        <tr v-for="(item, index) in pageData.printList6" :key="index">
                            <td>{{ item['process'] }}</td>
                            <td>{{ item['ACanUseHouseNum'] }}</td>
                            <td>{{ item['ACanUseWeight'] }}</td>
                            <td>{{ item['BCanUseHouseNum'] }}</td>
                            <td>{{ item['BCanUseWeight'] }}</td>
                            <td>{{ item['totalCanUseHouseNum'] }}</td>
                            <td>{{ item['totalCanUseWeight'] }}</td>
                        </tr>
                    </table>
                    <div style="width:100%;float:right;margin-top: 10px;">
                        <span style="margin-right: 300px;">制表人：</span>
                        <span>打印时间：{{ pageData.nowTime }}</span>
                    </div>
                </div>
            </div>
        </a-modal>
    </pageTabelLayout>
</template>
<script lang="ts" >
import { post } from '@/api/http'
import { useTable, useRowKey, useTableColumn, usePagination, useRowSelection } from '@/hooks/table'
import emitter from '@/hooks/useEventBus'
import { ref, reactive, onMounted, toRefs } from 'vue'
import Toolbar from '@/components/Toolbar.vue'
import { Button, Form, Message, Modal } from '@arco-design/web-vue'
import { FormInstance } from '@arco-design/web-vue/es/form'
import axios from 'axios'
import filedownload from 'js-file-download'
import usePermission from '@/store/modules/permission'
import PageTabelLayout from '@/components/pageTabelLayout.vue'
import MyTable from '@/components/MyTable'
import ButtonRenderer from '@/components/TableCellRenderer/ButtonRenderer'
import { template } from 'lodash'
import { setupGlobalComponent } from '@/layouts'
import { pagingList } from '@/api/paging'
// 引入

import { localeText } from '@/api/aggridZw'
import printJS from 'print-js'
interface BrandInfo {
    "id": any,
    "deleteState": any,
}

export default {
    name: "Production1",
    setup() {
        const total = ref(0);
        const page = ref(1);
        const size = ref(10);
        const headerShow = ref<boolean>(true)
        //分页
        function PageSize(val: any) {
            page.value = val
            if (id.value == 1) {
                doRefresh();
            } else if (id.value == 2) {
                doRefresh2();
            } else if (id.value == 3) {
                doRefresh();
            } else if (id.value == 4) {
                doRefresh4();
            } else if (id.value == 5) {
                doRefresh5();
            } else if (id.value == 6) {
                doRefresh6();
            }
        }
        function change1(val: any) {
            size.value = val
            if (id.value == 1) {
                doRefresh();
            } else if (id.value == 2) {
                doRefresh2();
            } else if (id.value == 3) {
                doRefresh();
            } else if (id.value == 4) {
                doRefresh4();
            } else if (id.value == 5) {
                doRefresh5();
            } else if (id.value == 6) {
                doRefresh6();
            }
        }
        let id = ref(1);
        const handoff = (e: any) => {
            id.value = e
            total.value = 0
            page.value = 1
            size.value = 10
            selectHandler()
        }
        //查询方法 定型部分
        function doRefresh() {

            pageData.pageLoading = true
            post({
                url: "dwWorkShop/hzDailyOne/getMachineDaily",
                data: {
                    "page": page.value,
                    "size": size.value,
                    beginTime: pageData.beginTime,
                    endTime: pageData.endTime,
                    workshop: pageData.workshop
                },
            })
                .then(({ data, code, message }: any) => {
                    if (code === 200) {
                        let list = []
                        list = data.data
                        data.colInfo['device'] = '合计'
                        // list.push(data.colInfo)

                        table.handleSuccess(list);
                        gridOption.value.setRowData(list);
                        gridOption.value.setPinnedBottomRowData([data.colInfo])
                        total.value = data.total;
                        pageData.printList = list.concat(data.colInfo)
                    } else {
                        Message.error({
                            content: message,
                            duration: 5000,
                        })
                    }
                })
                .catch(console.log).finally(() => {
                    pageData.pageLoading = false
                })
        }
        //查询方法 工艺分类
        function doRefresh2() {

            pageData.pageLoading = true
            post({
                url: "dwWorkShop/hzDailyOne/getProcessDaily",
                data: {
                    "page": page.value,
                    "size": size.value,
                    beginTime: pageData.beginTime,
                    endTime: pageData.endTime,
                    sectionList: pageData.sectionList,
                    workshop: pageData.workshop
                },
            })
                .then(({ data, code, message }: any) => {
                    if (code === 200) {
                        let list = []
                        list = data.data
                        data.colInfo['process'] = '合计'
                        // list.push(data.colInfo)

                        table.handleSuccess(list);
                        gridOption2.value.setRowData(list);
                        gridOption2.value.setPinnedBottomRowData([data.colInfo])
                        total.value = data.total;
                        pageData.printList2 = list.concat(data.colInfo)
                    } else {
                        Message.error({
                            content: message,
                            duration: 5000,
                        })
                    }
                })
                .catch(console.log).finally(() => {
                    pageData.pageLoading = false
                })
        }
        //查询方法 批色部分
        function doRefresh4() {
            pageData.pageLoading = true
            post({
                url: "dwWorkShop/hzDailyOne/getProcessDailyPlus",
                data: {
                    "page": page.value,
                    "size": size.value,
                    beginTime: pageData.beginTime,
                    endTime: pageData.endTime,
                    sectionList: pageData.sectionList,
                    workshop: pageData.workshop
                },
            })
                .then(({ data, code, message }: any) => {
                    if (code === 200) {
                        let list = []
                        list = data.data.info
                        data.data.colInfo['process'] = '合计'
                        // list.push(data.colInfo)

                        table.handleSuccess(list);
                        gridOption4.value.setRowData(list);
                        gridOption4.value.setPinnedBottomRowData([data.data.colInfo])
                        total.value = data.total;
                        pageData.printList4 = list.concat(data.data.colInfo)
                    } else {
                        Message.error({
                            content: message,
                            duration: 5000,
                        })
                    }
                })
                .catch(console.log).finally(() => {
                    pageData.pageLoading = false
                })
        }
        //查询方法 回修部分
        function doRefresh5() {
            pageData.pageLoading = true
            post({
                url: "dwWorkShop/hzDailyOne/getDutyDepDaily",
                data: {
                    // "page": page.value,
                    // "size": size.value,
                    beginTime: pageData.beginTime,
                    endTime: pageData.endTime,
                    // sectionList:pageData.sectionList,
                    workshop: pageData.workshop
                },
            })
                .then(({ data, code, message }: any) => {
                    if (code === 200) {
                        let list = []
                        list = data.info
                        data.colInfo['dutyDep'] = '合计'
                        // list.push(data.colInfo)

                        table.handleSuccess(list);
                        gridOption5.value.setRowData(list);
                        gridOption5.value.setPinnedBottomRowData([data.colInfo])
                        total.value = data.total;
                        pageData.printList5 = list.concat(data.colInfo)
                    } else {
                        Message.error({
                            content: message,
                            duration: 5000,
                        })
                    }
                })
                .catch(console.log).finally(() => {
                    pageData.pageLoading = false
                })
        }
          //查询方法 产量统计
          function doRefresh6() {
            pageData.pageLoading = true
            post({
                url: "dwWorkShop/hzDailyOne/getOutputStatistics",
                data: {
                    // "page": page.value,
                    // "size": size.value,
                    beginTime: pageData.beginTime,
                    endTime: pageData.endTime,
                    // sectionList:pageData.sectionList,
                    workshop: pageData.workshop
                },
            })
                .then(({ data, code, message }: any) => {
                    if (code === 200) {
                        let list = []
                        data['row1']['process']='定坯'
                        data['row2']['process']='成品送品控'
                        data['row3']['process']='定型有效产量'
                        list.push(data['row1'],data['row2'],data['row3'])
                        let row4={}
                        row4['ACanUseHouseNum']=data['row1']['ACanUseHouseNum']+data['row2']['ACanUseHouseNum']+data['row3']['ACanUseHouseNum']
                        row4['ACanUseWeight']=data['row1']['ACanUseWeight']+data['row2']['ACanUseWeight']+data['row3']['ACanUseWeight']
                        row4['BCanUseWeight']=data['row1']['BCanUseWeight']+data['row2']['BCanUseWeight']+data['row3']['BCanUseWeight']
                        row4['totalCanUseWeight']=data['row1']['totalCanUseWeight']+data['row2']['totalCanUseWeight']+data['row3']['totalCanUseWeight']
                        row4['BCanUseHouseNum']=data['row1']['BCanUseHouseNum']+data['row2']['BCanUseHouseNum']+data['row3']['BCanUseHouseNum']
                        row4['totalCanUseHouseNum']=data['row1']['totalCanUseHouseNum']+data['row2']['totalCanUseHouseNum']+data['row3']['totalCanUseHouseNum']
                        row4['process']='合计'
                        table.handleSuccess(list);
                        gridOption6.value.setRowData(list);
                        gridOption6.value.setPinnedBottomRowData([row4])
                        total.value = data.total;
                        pageData.printList6 = list.concat(row4)

                    } else {
                        Message.error({
                            content: message,
                            duration: 5000,
                        })
                    }
                })
                .catch(console.log).finally(() => {
                    pageData.pageLoading = false
                })
        }
        const pagination = usePagination(doRefresh);
        const table = useTable();



        //定型部分
        let tc: any = [
            {
                headerName: "设备编号",
                field: "device",
                width: 150,
            },
            {
                headerName: "A班",
                width: 150,
                children: [
                    { headerName: '过机量(吨)', field: 'AClasses' }
                ]
            },
            {
                headerName: "B班",
                width: 150,
                children: [
                    { headerName: '过机量(吨)', field: 'BClasses' }
                ]
            },
            {
                headerName: "合计",
                field: "totalNum",
                width: 150,
            },
        ]

        //工艺分类
        let tc2: any = [
            {
                headerName: "工序",
                field: "process",
                width: 150,
            },
            {
                headerName: "A班",
                width: 150,
                children: [
                    { headerName: '过机量(吨)', field: 'AClasses' }
                ]
            },
            {
                headerName: "B班",
                width: 150,
                children: [
                    { headerName: '过机量(吨)', field: 'BClasses' }
                ]
            },
            {
                headerName: "合计",
                field: "totalNum",
                width: 150,
            },
        ]

        //后整部分
        let tc3: any = [
            {
                headerName: "序号",
                field: "id",
                width: 150,
            },
            {
                headerName: "工序",
                field: "id",
                width: 150,
            },
            {
                headerName: "A班",
                width: 150,
                children: [
                    { headerName: '过机量(吨)', field: 'point' }
                ]
            },
            {
                headerName: "B班",
                width: 150,
                children: [
                    { headerName: '过机量(吨)', field: 'point' }
                ]
            },
            {
                headerName: "合计",
                field: "id",
                width: 150,
            },
        ]

        //批色部分
        let tc4: any = [
            {
                headerName: "工序",
                field: "process",
                width: 150,
            },
            {
                headerName: "A班",
                width: 150,
                children: [
                    { headerName: '条', field: 'ACanUseHouseNum' },
                    { headerName: '吨', field: 'ACanUseWeight' }
                ]
            },
            {
                headerName: "B班",
                width: 150,
                children: [
                    { headerName: '条', field: 'BCanUseHouseNum' },
                    { headerName: '吨', field: 'BCanUseWeight' }
                ]
            },
            {
                headerName: "合计",
                field: "id",
                width: 150,
                children: [
                    { headerName: '条', field: 'totalCanUseHouseNum' },
                    { headerName: '吨', field: 'totalCanUseWeight' }
                ]
            }
        ]

        //回修部分
        let tc5: any = [
            {
                headerName: "责任部门",
                field: "dutyDep",
                width: 150,
            },
            {
                headerName: "A班",
                width: 150,
                children: [
                    { headerName: '回修量', field: 'ACanUseWeight' },
                    { headerName: '比例', field: 'ARatio' }
                ]
            },
            {
                headerName: "B班",
                width: 150,
                children: [
                    { headerName: '回修量', field: 'BCanUseWeight' },
                    { headerName: '比例', field: 'BRatio' }
                ]
            },
            {
                headerName: "合计",
                field: "id",
                width: 150,
                children: [
                    { headerName: '回修量', field: 'totalNum' },
                    { headerName: '比例', field: 'totalRatio' }
                ]
            },
        ]

        //产量统计
        let tc6: any = [
            {
                headerName: "工艺",
                field: "process",
                width: 150
            },
            {
                headerName: "A班",
                width: 150,
                children: [
                    { headerName: '条', field: 'ACanUseHouseNum' },
                    { headerName: '吨', field: 'ACanUseWeight' }
                ]
            },
            {
                headerName: "B班",
                width: 300,
                children: [
                    { headerName: '条', field: 'BCanUseHouseNum' },
                    { headerName: '吨', field: 'BCanUseWeight' }
                ]
            },
            {
                headerName: "合计",
                width: 150,
                children: [
                    { headerName: '条', field: 'totalCanUseHouseNum' },
                    { headerName: '吨', field: 'totalCanUseWeight' }
                ]
            }
        ]

        let a = [{
            showRowGroup: 'hide_def',
            "headerName": "",
            "checkboxSelection": true,
            "headerCheckboxSelection": true,
            "pinned": "left",
            "width": 50,
            resizable: false,
            filter: false,
            sortable: false,
            minWidth: 50,
            maxWidth: 50,
            lockPosition: "left",
        }]
        tc = a.concat(tc)
        tc2 = a.concat(tc2)
        tc3 = a.concat(tc3)
        tc4 = a.concat(tc4)
        tc5 = a.concat(tc5)
        tc6 = a.concat(tc6)

        const dataForm = reactive<BrandInfo>({
            "id": null,
            "deleteState": 0,
        })
        const pageData = reactive<{
            nameList: [],
            pageLoading: boolean,
            sectionList: any[]
            workshop: any
            beginTime: any
            endTime: any
            gdList: any[]
            printList: any[]
            printList2: any[]
            printList3: any[]
            printList4: any[]
            printList5: any[]
            printList6: any[]
            nowTime: any
        }>({
            nameList: [],
            pageLoading: false,
            sectionList: [],
            workshop: "",
            beginTime: "",
            endTime: "",
            gdList: [],
            printList: [],
            printList2: [],
            printList3: [],
            printList4: [],
            printList5: [],
            printList6: [],
            nowTime: ""
        });

        onMounted(() => {
            getAllGd()
            // 切换tap到本页面执行的方法
            doRefresh();
            doRefresh2();
            doRefresh4();
            doRefresh5();
            doRefresh6();

        });

        //查询按钮
        const selectHandler = () => {
            page.value = 1
            if (id.value == 1) {
                doRefresh();
            } else if (id.value == 2) {
                doRefresh2();
            } else if (id.value == 3) {
                doRefresh();
            } else if (id.value == 4) {
                doRefresh4();
            } else if (id.value == 5) {
                doRefresh5();
            } else if (id.value == 6) {
                doRefresh6();
            }
        }

        // 表格准备事件
        const gridOption = ref()
        const gridReady = (params: any) => {
            gridOption.value = params.api
        }
        const gridOption2 = ref()
        const gridReady2 = (params: any) => {
            gridOption2.value = params.api
        }
        const gridOption3 = ref()
        const gridReady3 = (params: any) => {
            gridOption3.value = params.api
        }
        const gridOption4 = ref()
        const gridReady4 = (params: any) => {
            gridOption4.value = params.api
        }
        const gridOption5 = ref()
        const gridReady5 = (params: any) => {
            gridOption5.value = params.api
        }
        const gridOption6 = ref()
        const gridReady6 = (params: any) => {
            gridOption6.value = params.api
        }


        const pagingList1: any = ref(pagingList)
        const handleChange = (_data: any) => {
            table.handleSuccess(_data);
        }

        const defaultColDef = {
            sortable: true,
            resizable: true,
            filter: true,
            flex: 1,
            enableColResize: true,
        }
        //表格中文显示
        const localeText1: any = ref(localeText)

        //回车模糊查询
        const huiche = () => {

            selectHandler();

        }

        //打印
        const visible = ref(false);
        const handleOk = () => {
            printJS({
                printable: 'pro1',
                type: 'html',
                targetStyles: ['*'],
            })
            visible.value = false;
        };
        const handleCancel = () => {
            visible.value = false;
        }
        const print = () => {
            visible.value = true;
        }
        //查询所有工段
        function getAllGd() {
            post({
                url: "pdm/worksection/select",
                data: {
                    deleteState: 0
                },
            })
                .then(({ data, code }: any) => {
                    if (code === 200) {
                        pageData.gdList = data.map(function (o: any) {
                            return o['sectionName']
                        })
                        pageData.sectionList = pageData.gdList

                    }
                })

        }
        let rowClassRules = {
            'colCss': (params: any) => {
                let amount = params.data.device;
                return amount == '合计';
            },
        };
        let rowClassRules2 = {
            'colCss': (params: any) => {
                let amount = params.data.process;
                return amount == '合计';
            },
        };
        let rowClassRules4 = {
            'colCss': (params: any) => {
                let amount = params.data.process;
                return amount == '合计';
            },
        };
        let rowClassRules5 = {
            'colCss': (params: any) => {
                let amount = params.data.dutyDep;
                return amount == '合计';
            },
        };
        let rowClassRules6 = {
            'colCss': (params: any) => {
                let amount = params.data.process;
                return amount == '合计';
            },
        };
        let t = new Date()
        pageData.nowTime = t.toLocaleString();
        return {
            id,
            rowClassRules,
            rowClassRules2,
            rowClassRules4,
            rowClassRules5,
            rowClassRules6,
            getAllGd,
            visible,
            pagingList1,
            localeText1,
            pageData,
            dataForm,
            pagination,
            table,
            headerShow,
            total,
            page,
            size,
            tc,
            tc2,
            tc3,
            tc4,
            tc5,
            tc6,
            defaultColDef,
            gridOption,
            gridOption2,
            gridOption3,
            gridOption4,
            gridOption5,
            gridOption6,
            gridReady,
            gridReady2,
            gridReady3,
            gridReady4,
            gridReady5,
            gridReady6,
            huiche,
            selectHandler,
            handleChange,
            PageSize,
            change1,
            handoff,
            handleOk,
            handleCancel,
            print,
        };
    },
    components: { Toolbar, PageTabelLayout,  }
}
</script>
<style scoped lang="less">
// 表格边框线条
:deep(.ag-cell) {
    border-right: 1px solid #dde2eb;
}

:deep(.ag-header-cell) {
    border-right: 1px solid #dde2eb;
}

:deep(.ag-cell-value) {
    user-select: initial;
    -moz-user-select: text;
    -ms-user-select: text;
    -webkit-user-select: text;
}

:deep(.colCss) {
    background-color: #d0ffe2;
}

.table tr,
.table td span,
.table td {
    border: 1px solid #3e3e3e;
    text-align: center;
}
</style>